import FightAttri from './fightAttri';
import {
    totalConfig,
    propName
} from 'server/config/templateConfig';
import equipmentModel from './equimentModel';
let partnersConfig = totalConfig.partner;

let skillInfo = {
    id: 0, //技能id
    lvl: 1, //技能等级

}
//角色基础信息
class PartnerBasicInfo {
    static getInstance() {
        if (!PartnerBasicInfo.instance) {
            PartnerBasicInfo.instance = new PartnerBasicInfo();
        }
        return PartnerBasicInfo.instance;
    }

    create(opts) {
        opts = opts || {};
        return {
            lvl: opts.lvl || 1, //等级
            exp: opts.exp || 0, //经验
            skills: opts.skills || {

            }, //技能位置
            skillsInfo: opts.skillsInfo || {

            }, //技能信息
            con: opts.con || 0, //体质
            str: opts.str || 0, //力量
            will: opts.will || 0, //意志
            sta: opts.sta || 0, //耐力
            agile: opts.agile || 0, //敏捷
            attriPoint: opts.attriPoint || 0, //可分配的属性点
        }
    }
}

let partnerBasicInfo = PartnerBasicInfo.getInstance();

class PartnerModel {
    static getInstance() {
        if (!PartnerModel.instance) {
            PartnerModel.instance = new PartnerModel();
        }
        return PartnerModel.instance;
    }


    create(opts) {
        opts = opts || {};
        let templateId = opts.templateId;

        let partnerConfig = partnersConfig[opts.templateId];
        let data = {
            templateId: opts.templateId,
            name: opts.name || partnerConfig.name,
            indexId: opts.indexId || 0,
            equipments: equipmentModel.create(opts.equipments),
            status: opts.status || 1, //1为休息2为战斗
            basicInfo: partnerBasicInfo.create(opts.basicInfo),
        };
        return data;
    }
}

export default PartnerModel.getInstance();